//
//  HistoryExchangeTableViewCell.m
//  HYApp
//
//  Created by Jianbo Cai on 2020/8/14.
//  Copyright © 2020 Unidax. All rights reserved.
//

#import "HistoryExchangeTableViewCell.h"

@interface HistoryExchangeTableViewCell ()

@property (weak, nonatomic) IBOutlet UILabel *fromAccount;
@property (weak, nonatomic) IBOutlet UILabel *toAccount;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *sellSizeValue;
@property (weak, nonatomic) IBOutlet UILabel *buySizeValue;
@property (weak, nonatomic) IBOutlet UILabel *rateValue;
@property (weak, nonatomic) IBOutlet UILabel *statusLabel;

@property (weak, nonatomic) IBOutlet UILabel *sellSizeTitle;
@property (weak, nonatomic) IBOutlet UILabel *buySizeTitle;
@property (weak, nonatomic) IBOutlet UILabel *rateTitle;

@end

@implementation HistoryExchangeTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setExchangeEntity:(ExchangeListEntity *)exchangeEntity {
    _exchangeEntity = exchangeEntity;
    
    self.sellSizeTitle.text = JFMainLocalizedString(@"exchange.from");
    self.buySizeTitle.text = JFMainLocalizedString(@"exchange.to");
    self.rateTitle.text = JFMainLocalizedString(@"transactions.rate");
    
    self.fromAccount.text = exchangeEntity.sell_asset_symbol;
    self.toAccount.text = exchangeEntity.buy_asset_symbol;
    self.sellSizeValue.text = exchangeEntity.sell_amount;
    self.buySizeValue.text = exchangeEntity.buy_amount;
    self.statusLabel.text = exchangeEntity.status;
    self.rateValue.text = exchangeEntity.rate;
    self.timeLabel.text = exchangeEntity.date;
}

- (void)setTransfersEntity:(TransfersListEntity *)transfersEntity {
    _transfersEntity = transfersEntity;
    
    self.sellSizeTitle.text = JFMainLocalizedString(@"transactions.asset");
    self.buySizeTitle.text = JFMainLocalizedString(@"transactions.amount");
    self.rateTitle.text = JFMainLocalizedString(@"withdraw.fee");
    
    self.fromAccount.text = [transfersEntity.from_account_label getAccountString];
    self.toAccount.text = [transfersEntity.to_account_label getAccountString];
    self.sellSizeValue.text = transfersEntity.asset_symbol;
    self.buySizeValue.text = transfersEntity.amount;
    self.statusLabel.text = transfersEntity.status;
    self.rateValue.text = transfersEntity.fee_amount;
    self.timeLabel.text = transfersEntity.date;
}

@end
